\documentclass[letterpaper,11pt,pdftex]{article}
\usepackage[left=1in,right=1in,bottom=1in]{geometry}

% \usepackage{mathptmx}
\usepackage[T1]{fontenc}
\usepackage{textcomp}

\usepackage{listings}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{upgreek}
\usepackage[all]{xy}
\usepackage{url}

\usepackage{datetime}
%\renewcommand{\dateseparator}{}
\newdateformat{yyyymmdd}{\twodigit\THEYEAR\twodigit\THEMONTH\twodigit\THEDAY}

\usepackage{graphicx}
\usepackage{lscape}
\usepackage{indentfirst}
\pagestyle{plain}
\usepackage{setspace}
%\doublespacing
\renewcommand{\baselinestretch}{1.1}
\usepackage[numbers,sort&compress]{natbib}

\usepackage{xspace}
\newcommand{\nch}{\ensuremath{\mathcal{N}}\xspace}
\newcommand{\nph}{\ensuremath{n}\xspace}
\newcommand{\nc}{\ensuremath{i}\xspace}
\newcommand{\wc}{\ensuremath{W}\xspace}

\title{My own collection of trickeries in mathematics and physics formalism}
\author{Yuan Mei}
\date{Created: 20120901, \quad Last modified: \yyyymmdd\today}
\begin{document}
\maketitle

\section{Fourier Transform and FFT}
Nyquist frequency.

\section{Calculation}
For \nph photons to generate \nc coincidence, we pick \nc channels out of total \nch photon
counting channels first, which has these many ways:
\begin{equation*}
  \binom{\nch}{\nc}\,.
\end{equation*}
For each \nc-channel pattern, \nph photons should fill up all \nc channels with at least 1 photon
in each channel.  It is equivalent to the problem putting \nph indistinguishable balls into \nc
distinguishable boxes, leaving no box empty.  The answer to this problem is
\begin{equation*}
  \binom{\nph-1}{\nc-1}\,.
\end{equation*}
The trick to consider this problem is, when \nph balls line up, there are $\nph-1$ gaps between
adjacent balls; the task is to put $\nc-1$ walls into those $\nph-1$ gaps in order to split balls
into \nc groups (boxes).  The order of walls makes boxes distinguishable while balls have no
particular order for lining up.

Combining the above pieces together, the number of photon hitting patterns that generates
coincidence \nc is
\begin{equation*}
  \wc(i) = \binom{\nph-1}{\nc-1}\cdot\binom{\nch}{\nc}\,.
\end{equation*}

The total number of patterns for all coincidences is
\begin{equation*}
  \sum_{i=1}^\nph\wc(i) = \sum_{i=1}^\nph\binom{\nph-1}{\nc-1}\cdot\binom{\nch}{\nc}\,.
\end{equation*}

The probability for getting coincidence $\nc\geq j$ is
\begin{equation*}\displaystyle
  P(\nc\geq j) = \frac{\sum_{i=j}^\nph\wc(i)}{\sum_{i=1}^\nph\wc(i)} = 
\frac{\sum_{i=j}^\nph\binom{\nph-1}{\nc-1}\cdot\binom{\nch}{\nc}}
{\sum_{i=1}^\nph\binom{\nph-1}{\nc-1}\cdot\binom{\nch}{\nc}}\,.
\end{equation*}

\section{Example}
With $\nch = 16$ and $\nph = 5$, the probability for getting $\geq4$ coincidence is
\begin{equation*}
  \begin{aligned}
    P(\nc\geq4) &= \frac{4\cdot\binom{16}{4}+\binom{16}{5}}
    {\binom{16}{1}+4\cdot\binom{16}{2}+6\cdot\binom{16}{3}+4\cdot\binom{16}{4}+\binom{16}{5}}\\
    &=\frac{11648}{15504}\approx0.751\,.
  \end{aligned}
\end{equation*}

\section{Discussion}
Of course the above calculations assume photons have equal probability hitting any of the
channel.  When it is not the case, a prior probability can be assigned to each channel and the
calculation has to be convolved.

\renewcommand{\bibname}{Bibliography}
\bibliographystyle{plainnat}
\bibliography{refs}
% \begin{thebibliography}{99}
% \bibitem{tag0} Bib1 \url{http://www.google.com}
% \end{thebibliography}
\end{document}

%%% Local Variables: 
%%% mode: latex
%%% TeX-master: t
%%% End: 
